package com.wht.bill.adapter;

import android.graphics.Color;
import android.text.TextUtils;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.wht.bill.R;
import com.wht.bill.bean.AccountBean;
import com.wht.bill.bean.OutcomeClassifyBean;


/**
 * 账户列表适配器
 */
public class ClassifyAdapter extends BaseQuickAdapter<OutcomeClassifyBean, BaseViewHolder> {


    public ClassifyAdapter() {
        super(R.layout.item_tb_type);
    }


    @Override
    protected void convert(BaseViewHolder helper, OutcomeClassifyBean item) {
        TextView tvTitle = helper.getView(R.id.item_tb_type_tv);

        if (item != null) {
            if (!TextUtils.isEmpty(item.name)) {
                tvTitle.setText(item.name);
            } else {
                tvTitle.setText("");
            }
            helper.setBackgroundColor(R.id.view_layer, item.isSelect ? Color.parseColor("#80000000") : Color.parseColor("#00000000"));
            Glide.with(getContext())
                    .load(item.img)
                    .into((ImageView) helper.getView(R.id.item_tb_type_img));
        }
    }
}
